package com.ruoyi.merchant.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.merchant.mapper.MerchantCouponOrderMapper;
import com.ruoyi.merchant.domain.MerchantCouponOrder;
import com.ruoyi.merchant.service.IMerchantCouponOrderService;

/**
 * 优惠券购买订单Service业务层处理
 * 
 * @author dongdong
 * @date 2025-10-27
 */
@Service
public class MerchantCouponOrderServiceImpl implements IMerchantCouponOrderService 
{
    @Autowired
    private MerchantCouponOrderMapper merchantCouponOrderMapper;

    /**
     * 查询优惠券购买订单
     * 
     * @param id 优惠券购买订单主键
     * @return 优惠券购买订单
     */
    @Override
    public MerchantCouponOrder selectMerchantCouponOrderById(Long id)
    {
        return merchantCouponOrderMapper.selectMerchantCouponOrderById(id);
    }

    /**
     * 查询优惠券购买订单列表
     * 
     * @param merchantCouponOrder 优惠券购买订单
     * @return 优惠券购买订单
     */
    @Override
    public List<MerchantCouponOrder> selectMerchantCouponOrderList(MerchantCouponOrder merchantCouponOrder)
    {
        return merchantCouponOrderMapper.selectMerchantCouponOrderList(merchantCouponOrder);
    }

    /**
     * 新增优惠券购买订单
     * 
     * @param merchantCouponOrder 优惠券购买订单
     * @return 结果
     */
    @Override
    public int insertMerchantCouponOrder(MerchantCouponOrder merchantCouponOrder)
    {
        merchantCouponOrder.setCreateTime(DateUtils.getNowDate());
        return merchantCouponOrderMapper.insertMerchantCouponOrder(merchantCouponOrder);
    }

    /**
     * 修改优惠券购买订单
     * 
     * @param merchantCouponOrder 优惠券购买订单
     * @return 结果
     */
    @Override
    public int updateMerchantCouponOrder(MerchantCouponOrder merchantCouponOrder)
    {
        merchantCouponOrder.setUpdateTime(DateUtils.getNowDate());
        return merchantCouponOrderMapper.updateMerchantCouponOrder(merchantCouponOrder);
    }

    /**
     * 批量删除优惠券购买订单
     * 
     * @param ids 需要删除的优惠券购买订单主键
     * @return 结果
     */
    @Override
    public int deleteMerchantCouponOrderByIds(Long[] ids)
    {
        return merchantCouponOrderMapper.deleteMerchantCouponOrderByIds(ids);
    }

    /**
     * 删除优惠券购买订单信息
     * 
     * @param id 优惠券购买订单主键
     * @return 结果
     */
    @Override
    public int deleteMerchantCouponOrderById(Long id)
    {
        return merchantCouponOrderMapper.deleteMerchantCouponOrderById(id);
    }
}
